import request from './index'

// 获取知识列表
export function getKnowledge() {
  return request({
    url: '/knowledge',
    method: 'get',
  })
}

// 获取知识详情
export function getKnowledgeById(id) {
  return request({
    url: `/knowledge/${id}`,
    method: 'get',
  })
}

// 创建知识文章
export function createKnowledge(data) {
  return request({
    url: '/knowledge',
    method: 'post',
    data,
  })
}

// 更新知识文章
export function updateKnowledge(id, data) {
  return request({
    url: `/knowledge/${id}`,
    method: 'put',
    data,
  })
}

// 删除知识文章
export function deleteKnowledge(id) {
  return request({
    url: `/knowledge/${id}`,
    method: 'delete',
  })
}
